//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.sending;

import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.*;

public class SendingCmdPanel extends JPanel {

    public SendingCmdPanel() {
        jPanel = null;
        saveButton = null;
        printButton = null;
        clearButton = null;
        deleteButton = null;
        initialize();
    }

    private void initialize() {
        setSize(340, 36);
        add(getJPanel(), null);
    }

    private JPanel getJPanel() {
        if (jPanel == null) {
            FlowLayout flowLayout6 = new FlowLayout();
            jPanel = new JPanel();
            jPanel.setLayout(flowLayout6);
            jPanel.setPreferredSize(new Dimension(330, 26));
            flowLayout6.setHgap(2);
            flowLayout6.setVgap(2);
            flowLayout6.setAlignment(0);
            jPanel.add(getSaveButton(), null);
            jPanel.add(getDeleteButton(), null);
            jPanel.add(getClearButton(), null);
            jPanel.add(getPrintButton(), null);
        }
        return jPanel;
    }

    private JButton getSaveButton() {
        if (saveButton == null) {
            saveButton = new JButton();
            saveButton.setPreferredSize(new Dimension(22, 22));
            saveButton.setContentAreaFilled(false);
            saveButton.setBorderPainted(false);
            saveButton.setIcon(new ImageIcon(getClass().getResource("/org/jpgolay/gui/images/save.png")));
            saveButton.setToolTipText("Enregistrer l'exp\351dition.");
            saveButton.setFocusPainted(false);
        }
        return saveButton;
    }

    private JButton getClearButton() {
        if (clearButton == null) {
            clearButton = new JButton();
            clearButton.setPreferredSize(new Dimension(22, 22));
            clearButton.setBorderPainted(false);
            clearButton.setContentAreaFilled(false);
            clearButton.setFocusPainted(false);
            clearButton.setIcon(new ImageIcon(getClass().getResource("/org/jpgolay/me/images/refresh.gif")));
            clearButton.setToolTipText("R\351initialiser les champs");
        }
        return clearButton;
    }

    private JButton getPrintButton() {
        if (printButton == null) {
            printButton = new JButton();
            printButton.setPreferredSize(new Dimension(22, 22));
            String s = "<html>G\351n\351rer l'impression des<br>\351tiquettes correspondantes<br>\340 l'exp\351dition.</html>";
            printButton.setToolTipText(s);
            printButton.setFocusPainted(false);
            printButton.setBorderPainted(false);
            printButton.setContentAreaFilled(false);
            printButton.setIcon(new ImageIcon(getClass().getResource("/org/jpgolay/gui/images/printer.png")));
        }
        return printButton;
    }

    private JButton getDeleteButton() {
        if (deleteButton == null) {
            deleteButton = new JButton();
            deleteButton.setPreferredSize(new Dimension(22, 22));
            deleteButton.setContentAreaFilled(false);
            deleteButton.setBorderPainted(false);
            deleteButton.setFocusPainted(false);
            deleteButton.setIcon(new ImageIcon(getClass().getResource("/org/jpgolay/gui/images/delete.png")));
            deleteButton.setToolTipText("Suprimer l'exp\351dition");
        }
        return deleteButton;
    }

    public JButton getPrint() {
        return getPrintButton();
    }

    public JButton getSave() {
        return getSaveButton();
    }

    public JButton getClear() {
        return getClearButton();
    }

    public JButton getDelete() {
        return getDeleteButton();
    }
    private JPanel jPanel;
    private JButton saveButton;
    private JButton printButton;
    private JButton clearButton;
    private JButton deleteButton;
}
